import { Controller, Get, Inject, Query } from '@nestjs/common';
import { AppService } from './app.service';
import * as Minio from 'minio'
import { MINIO_CLIENT } from './minio/minio.module';
@Controller()
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Inject(MINIO_CLIENT)
  private minioClient: Minio.Client

  // 预签名
  @Get('presignedUrl')
  async presignedUrl(@Query('name') name: string) {
    return this.minioClient.presignedPutObject('photos', name, 3600);
  }

  @Get()
  getHello(): string {
    return this.appService.getHello();
  }
}
